<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站后台管理系统</title>
<meta name="keywords" content="">
<meta name="description" content="">
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="css/ie6.css"/>
<![endif]-->
<link rel="stylesheet" type="text/css"  href="../../../../public/layui/css/layui.css">
<link href="../../../../public/admin/css/style_v2.0.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/style_v2.0.css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
</head>
<body>
<div class="position mt10">当前位置：<a href="{:U('Index/main')}">后台首页</a> > <a href="{:U('web/account')}">账号信息</a>  >  全部账号信息</div>
<div id="container">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>账号信息</legend>
</fieldset>
<div class="layui-form">
    <div class="layui-btn-group">
         <a href="" class="layui-btn layui-btn-big"><i class="layui-icon">&#xe60a;</i>账号列表</a>&nbsp;
         <button class="layui-btn layui-btn-big"  data-method="notice" ><i class="layui-icon">&#xe654;</i> 添加账号</button>&nbsp;
         <!--<a href="{:U('web/export/')}"  class="layui-btn layui-btn-big layui-btn-normal"><i class="layui-icon">&#xe62d;</i> 导出报表</a>&nbsp;-->
    </div>
</div>
<!--高级搜索-->
<div class="c"></div>
<div class="layui-form" style="background-color:#FFFFFF;">
<table class="layui-table" id="table">
    <thead>
    <tr style="text-align:center;">
      <th style="text-align:center;"></th>
      <th style="text-align:center;">服务商</th>
      <th style="text-align:center;">链接</th>
      <th style="text-align:center;">账号</th>
      <th style="text-align:center;">密码</th>
      <th style="text-align:center;">邮箱</th>
      <th colspan="2" style="text-align:center;">操作</th>
    </tr> 
    </thead>
    <form id="form2" name="form2" method="post" action="{:U('Admin/Web/account_del/')}">  
     <volist name="list" id="r">
    <tr>
      <td  align="center" class="layui-form-item"><input type="checkbox" id="aid[]" title="{$r.aid}"  lay-skin="primary"  name="aid[]" value="{$r.aid}"/></td>
      <td align="center" height="22px">{$r.aname}</td>
      <td align="center" height="22px">{$r.aurl} <a href="{$r.aurl}" target="_blank"><font color="#009688">【访问】</font></a></td>
      <td  align="center">{$r.account}</td>
      <td  align="center" ><a href="javascript:void(0)" id="lookpwd" data-id="{$r.aid}">******</a></td>
      <td  align="center">{$r.email}</td>
      <td  align="center"><a href="{:U('Admin/Web/account_edit/',array('aid' => $r['aid']))}" title="编辑" class="layui-btn layui-btn-small"><i class="layui-icon">&#xe642;</i></a><a href="{:U('Admin/Web/account_del',array('aid' => $r['aid']))}" class="layui-btn layui-btn-small layui-btn-danger" title="删除" onClick="return checkConfirm('您确认删除记录?')"><i class="layui-icon">&#xe640;</i></a></td>
    </tr>
    </volist>
    <tr>
      <td align="center"><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></td>
      <td colspan="10">
      <div style="padding-left:20px;">  
         <input type="button" value="全选" name="selectall" class="layui-btn" />
         <input type="button" value="反选" name="selectno" class="layui-btn "/>
         <button  name="btnDel" lay-submit="" lay-filter="btnDel" class="layui-btn layui-btn-danger" />删除</button>
      </div>      </td>
    </tr>
   </form>
    </table>
    <div class="c"></div>
    <div id="pages">{$page}</div>      
</div>
</div>
</body>
</html>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<form name=reg action="{:U('Admin/Web/account_update')}"  enctype="multipart/form-data"  method="post"  class="layui-form" id="account_add" style="display:none;">
<div class="layui-form">
    <table class="layui-table">
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>网站名称：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="aname" type="text" id="aname" value="" required  lay-verify="" placeholder="网站名称" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>网站域名：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;">
      <input name="aurl" type="text" id="aurl" value="http://" required  lay-verify="aurl" placeholder="网站域名" autocomplete="off" class="layui-input"></span>
      </td>
    </tr>
    <tr>
	  <td align="right"><font color=red size="1">·</font>注册账号：</td>
	  <td>
      <span class="table_span" style="width:300px; float:left;"><input name="account" type="text" id="account" value="" required   lay-verify="account" placeholder="注册账号" autocomplete="off" class="layui-input"></span>
      </td>
    </tr>
    <tr>
	  <td align="right"><font color=red size="1">·</font>账号密码：</td>
	  <td><span class="table_span" style="width:300px; float:left;"><input name="accountpwd" type="text" id="accountpwd" value=""  lay-verify="accountpwd" placeholder="账号密码" autocomplete="off" class="layui-input"></span>
      </td>
    </tr>
    <tr>
	  <td align="right">预留电话：</td>
	  <td><span class="table_span" style="width:300px; float:left;"><input name="phone" type="text" id="phone" value="" lay-verify="phone" placeholder="预留电话" autocomplete="off" class="layui-input"></span>
      </td>
    </tr>
    <tr>
	  <td align="right">注册邮箱：</td>
	  <td><span class="table_span" style="width:300px; float:left;"><input name="email" type="text" id="email"  lay-verify="email" placeholder="注册邮箱" autocomplete="off" class="layui-input"></span>
      </td>
    </tr>
    <tr>
	  <td align="right">其他信息：</td>
	  <td><span class="table_span" style="width:300px; float:left;"><textarea name="content" type="text" id="content" value=""  lay-verify="" placeholder="其他信息" autocomplete="off" class="layui-textarea" style="height:60px;"></textarea></span>
      </td>
    </tr>
    <tr> 
	  <td colspan=2 align="center" valign="middle">
		<input type="submit" name="Submit" value="确&nbsp; &nbsp;定" class="layui-btn" >
		<input type="reset" name="Submit2" value="重　置" class="layui-btn layui-btn-primary" >		 </td>
	</tr>
    </table>
</div>
</form>
<script>
 $(function(){
      $(".layui-table").find('tr').find("#lookpwd").click(function(){
	       index =  $(".layui-table").find('tr').find("#lookpwd").index(this) ; 
		   var $lookpwd = $(".layui-table").find('tr').find("#lookpwd"); 
	       var $aid = $(this).attr("data-id");
		   $(".layui-table").find('tr').find("#lookpwd").html("******");
		   $lookpwd.eq(index).html("<font color=red>请求中...</font>");
		   $.ajax({
			   url:"{:U('Web/lookpwd/')}",
			   dataType:"json",
			   data: {'aid': $aid },
			   type:'get',
			   success:function(data){
				   if(data){
				       $lookpwd.eq(index).html(data);
					   console.log(index);
				   }else{
				       $lookpwd.eq(index).html("禁止查看");
				   }
			   },
		   });
	       var timer = setTimeout(function(){
		        $lookpwd.eq(index).html("******");
		   },5000);
		   //clearInterval(timer);
	  });
	  
	   
 });
</script>
<script>
//Demo
layui.use('form', function(){
  var form = layui.form;
   var active = {
       notice: function(){
		  layer.open({
			type: 1
			,title: '新增账号' //不显示标题栏
			,closeBtn: 2
			,area: ['600px','590px']
			,shade: 0.4
			,id: 'LAY_layuipro' //设定一个id，防止重复弹出
			//,btn: ['提交', '关闭']
			,btnAlign: 'c'
			,moveType: 1 //拖拽模式，0或者1
			,content: $("#account_add"),
            })
       }
   }
   
    $('.layui-btn-group .layui-btn').on('click', function(){
		var othis = $(this), method = othis.data('method');
		active[method] ? active[method].call(this, othis) : '';
	  });
   
  //监听提交
  form.on('submit(btnDel)', function(data){
    //layer.msg(JSON.stringify(data.field));
	title: '最终的提交信息'
	return true;
  });

});
</script>
